<?php

class myCredentials extends sfFilter
{
  public function execute ($filterChain)
  {
      $request = $this->getContext()->getRequest();
      $response = $this->getContext()->getResponse();

      if($request->getParameter('razred_id') or $request->getParameter('grupa_id'))
      {
        $credentials = new Credentials();
        $razred_razrednis = $credentials->getRazrednis();
        $razred_predajes = $credentials->getPredajes();

        if(!in_array($request->getParameter('razred_id'), $razred_razrednis) and !in_array($request->getParameter('razred_id'), $razred_predajes)
           and !in_array($request->getParameter('grupa_id'), $razred_razrednis) and !in_array($request->getParameter('grupa_id'), $razred_predajes))
          die($credentials->getError());
      }

      $filterChain->execute();
  }
}